/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package searchprime;

import java.util.Scanner;

/**
 *
 * @author TQNINH
 */
public class SynchronizeSearch {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        CountPrimesThread cpt = new CountPrimesThread();
        int numberOfThreads = 0;
        
        System.out.print("How many threads do you want to use (from 1 " +
                "to 5)? ");
        Scanner input = new Scanner(System.in);
        numberOfThreads = input.nextInt();
        
        while(numberOfThreads < 1 || numberOfThreads > 5){
            if(numberOfThreads < 1 || numberOfThreads > 5){
                System.out.println("Please enter 1, 2, 3, 4 or 5!");
            }
        }
        cpt.countPrimesWithThreads(numberOfThreads);
    }
}
